package com.sc.pattern.gate;

/**
 * Created  on 2018/1/6.
 *
 * @author sc
 */
public class Human extends Thread{
    private final String name;
    private final String address;
    private final Gate gate;

    public Human(String name,String address,Gate gate){
        this.address = address;
        this.name = name;
        this.gate =gate;
    }

    @Override
    public void run() {
        System.out.println(name+"Begin");
        while (true){
            this.gate.pass(name,address);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
